/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package component.stylesheet;

import Globals.AllGlobal;
import component.stylesheet.component.XlsLoaderProgress;
import controller.MyController;
import database.operate.OperateMyDatabaseImpl;
import java.io.FileInputStream;
import javafx.scene.control.TreeItem;
import myfx.jfxpanel.MyTreeContainer;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

/**
 *
 * @author Administrator
 */
public class XlsLoader {
    private MyController controller;
    private MyTreeContainer fxContainer;
    private String filepath;
    private int progressI=0;
    private int countNow=0;
    private int countMax=0;
    
    public XlsLoader(String filepath,MyTreeContainer fxContainer,MyController controller){
        this.controller=controller;
        this.fxContainer=fxContainer;
        this.filepath=filepath;
    }
    public void doLoad() throws Exception{

        XlsLoaderProgress progress=new XlsLoaderProgress();
        TreeItem<String> rootItem=fxContainer.getTree().getRoot();
        
        String extName = filepath.substring(filepath.lastIndexOf(java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("."))+1);
        System.out.println(java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("来自XLSLOADER"));
        if(extName.equals(java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("XLS"))){
            System.out.println(java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("来自XLSLOADER的XLS"));
            HSSFWorkbook hssfw=new HSSFWorkbook(new FileInputStream(this.filepath));
            HSSFSheet gZMSheet=hssfw.getSheet(java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("工作面"));
            HSSFSheet zCMSheet=hssfw.getSheet(java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("钻场"));
            HSSFSheet zKMSheet=hssfw.getSheet(java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("钻孔"));
            for(int i=1;i<=gZMSheet.getLastRowNum();i++){
                HSSFRow hssfr=gZMSheet.getRow(i);
                long timelong2=System.currentTimeMillis();
                if(hssfr.getCell(2)!=null){
                    timelong2=hssfr.getCell(2).getDateCellValue().getTime();
                }
                OperateMyDatabaseImpl.doAdd
                    (java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("INSERT INTO GONGZUOMIAN VALUES(")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")+hssfr.getCell(0).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(1).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+String.valueOf(timelong2)+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(3).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(4).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(5).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(6).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(7).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(8).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(9).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(10).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(11).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(12).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(13).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(14).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(15).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(16).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(");"));
                TreeItem<String> gzmItem=new TreeItem<String>(hssfr.getCell(0).getStringCellValue());
                rootItem.getChildren().add(gzmItem);
                for(int j=1;j<=zCMSheet.getLastRowNum();j++){
                    HSSFRow zcHSSFRow=zCMSheet.getRow(j);
                    long timelong1=System.currentTimeMillis();
                    if(zcHSSFRow.getCell(5).getDateCellValue()!=null){
                        timelong1=zcHSSFRow.getCell(5).getDateCellValue().getTime();
                    }   
                    TreeItem<String> zcItem;
                    if(zcHSSFRow.getCell(0)!=null){
                        String zcNameString=zcHSSFRow.getCell(0).getStringCellValue();
                        zcItem=new TreeItem<String>(zcNameString);
                    }else{
                        zcItem=new TreeItem<String>(java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("空钻场无名称"));
                    }                   
                    if(zcHSSFRow.getCell(4).getStringCellValue().
                            equals(hssfr.getCell(0).getStringCellValue())){
                        OperateMyDatabaseImpl.doAdd
                        (java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("INSERT INTO ZUANCHANG VALUES(")
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")+zcHSSFRow.getCell(0).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zcHSSFRow.getCell(1).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zcHSSFRow.getCell(2).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zcHSSFRow.getCell(3).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zcHSSFRow.getCell(4).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+String.valueOf(timelong1)+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zcHSSFRow.getCell(6).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zcHSSFRow.getCell(7).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")                    
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(");"));
                        
                        gzmItem.getChildren().add(zcItem);
                    }
                    for(int k=1;k<=zKMSheet.getLastRowNum();k++){
                        HSSFRow zkHSSFRow=zKMSheet.getRow(k);
                        long timelong=System.currentTimeMillis();
                        countMax=zKMSheet.getLastRowNum();
                        if(zkHSSFRow.getCell(20)!=null){
//                            timelong=zkHSSFRow.getCell(20).getDateCellValue().getTime();
                        }
                        String beizhu=java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("无");
                        if(zkHSSFRow.getCell(11)!=null){
                            beizhu=zkHSSFRow.getCell(11).getStringCellValue();
                        }
                        if(zkHSSFRow.getCell(12)!=null&&zkHSSFRow.getCell(12).getStringCellValue().
                            equals(zcHSSFRow.getCell(0).getStringCellValue())){
                            countNow++;
                            progressI=(countNow*100/countMax);
                            progress.setValue(progressI);
                            
                            OperateMyDatabaseImpl.doAdd
                            (java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("INSERT INTO ZUANKONG VALUES(")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")+zkHSSFRow.getCell(0).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(1).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(2).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(3).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(4).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(5).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(6).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(7).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")   
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(8).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(9).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(10).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+beizhu+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(12).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+12+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+AllGlobal.ZHUJIANGKONGCHONGHE_N+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")  
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+AllGlobal.ZHUJIANGKONGGENGXIN_Y+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(13).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+AllGlobal.ZHUJIANGKONGJUNZHI_N+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(14).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(15).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+String.valueOf(timelong)+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+10+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")  
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+10+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(16).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(");"));
                            TreeItem<String> zkItem;
                            if(zkHSSFRow.getCell(0)!=null){
                                zkItem=new TreeItem<String>(zkHSSFRow.getCell(0).getStringCellValue());
                            }
                            else{
                                zkItem=new TreeItem<String>(java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("空钻孔无名称"));
                            }
                            zcItem.getChildren().add(zkItem);
                        }
                    }
                }
            }
        }else{
            XSSFWorkbook hssfw=new XSSFWorkbook(new FileInputStream(this.filepath));
            XSSFSheet gZMSheet=hssfw.getSheet(java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("工作面"));
            XSSFSheet zCMSheet=hssfw.getSheet(java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("钻场"));
            XSSFSheet zKMSheet=hssfw.getSheet(java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("钻孔"));
            for(int i=1;i<=gZMSheet.getLastRowNum();i++){
                XSSFRow hssfr=gZMSheet.getRow(i);
                long timelong2=System.currentTimeMillis();
                if(hssfr.getCell(2)!=null){
                    timelong2=hssfr.getCell(2).getDateCellValue().getTime();
                }
                OperateMyDatabaseImpl.doAdd
                    (java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("INSERT INTO GONGZUOMIAN VALUES(")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")+hssfr.getCell(0).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(1).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+String.valueOf(timelong2)+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(3).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(4).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(5).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(6).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(7).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(8).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(9).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(10).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(11).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(12).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(13).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(14).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(15).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+hssfr.getCell(16).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                    + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(");"));
                TreeItem<String> gzmItem=new TreeItem<String>(hssfr.getCell(0).getStringCellValue());
                rootItem.getChildren().add(gzmItem);
                
                
                for(int j=1;j<=zCMSheet.getLastRowNum();j++){
                    XSSFRow zcHSSFRow=zCMSheet.getRow(j);
                    long timelong1=System.currentTimeMillis();
                    if(zcHSSFRow.getCell(5).getDateCellValue()!=null){
                        timelong1=zcHSSFRow.getCell(5).getDateCellValue().getTime();
                    }   
                    TreeItem<String> zcItem;
                    if(zcHSSFRow.getCell(0)!=null){
                        String zcNameString=zcHSSFRow.getCell(0).getStringCellValue();
                        zcItem=new TreeItem<String>(zcNameString);
                    }else{
                        zcItem=new TreeItem<String>(java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("空钻场无名称"));
                    }                   
                    if(zcHSSFRow.getCell(4).getStringCellValue().
                            equals(hssfr.getCell(0).getStringCellValue())){
                        OperateMyDatabaseImpl.doAdd
                        (java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("INSERT INTO ZUANCHANG VALUES(")
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")+zcHSSFRow.getCell(0).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zcHSSFRow.getCell(1).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zcHSSFRow.getCell(2).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zcHSSFRow.getCell(3).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zcHSSFRow.getCell(4).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+String.valueOf(timelong1)+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zcHSSFRow.getCell(6).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zcHSSFRow.getCell(7).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")                    
                        + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(");"));
                        
                        gzmItem.getChildren().add(zcItem);
                    }
                    for(int k=1;k<=zKMSheet.getLastRowNum();k++){
                        XSSFRow zkHSSFRow=zKMSheet.getRow(k);
                        long timelong=System.currentTimeMillis();
                        countMax=zKMSheet.getLastRowNum();
                        if(zkHSSFRow.getCell(20)!=null){
//                            timelong=zkHSSFRow.getCell(20).getDateCellValue().getTime();
                        }
                        String beizhu=java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("无");
                        if(zkHSSFRow.getCell(11)!=null){
                            beizhu=zkHSSFRow.getCell(11).getStringCellValue();
                        }
                        if(zkHSSFRow.getCell(12)!=null&&zkHSSFRow.getCell(12).getStringCellValue().
                            equals(zcHSSFRow.getCell(0).getStringCellValue())){
                            countNow++;
                            progressI=(countNow*100/countMax);
                            progress.setValue(progressI);
                            
                            OperateMyDatabaseImpl.doAdd
                            (java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("INSERT INTO ZUANKONG VALUES(")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")+zkHSSFRow.getCell(0).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(1).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(2).getNumericCellValue()*(-1)+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(3).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(4).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(5).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(6).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(7).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")   
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(8).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(9).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(10).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+beizhu+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(12).getStringCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+12+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+AllGlobal.ZHUJIANGKONGCHONGHE_N+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")  
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+AllGlobal.ZHUJIANGKONGGENGXIN_Y+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(13).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+AllGlobal.ZHUJIANGKONGJUNZHI_N+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(14).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(15).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+String.valueOf(timelong)+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+10+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")  
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+10+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(",'")+zkHSSFRow.getCell(16).getNumericCellValue()+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("'")
                            + java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(");"));
                            TreeItem<String> zkItem;
                            if(zkHSSFRow.getCell(0)!=null){
                                zkItem=new TreeItem<String>(zkHSSFRow.getCell(0).getStringCellValue());
                            }
                            else{
                                zkItem=new TreeItem<String>(java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("空钻孔无名称"));
                            }
                            zcItem.getChildren().add(zkItem);
                        }
                    }
                }
            }
        }
        controller.getFxStatus().updateStatus(java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("导入数据完成"), this.getClass().toString(), this.filepath, this.filepath);
        progress.setValue(100);
        controller.getCanvas().requestFocus();
    }

    public String getFilepath() {
        return filepath;
    }

    public void setFilepath(String filepath) {
        this.filepath = filepath;
    }
    
}
